package com.ycb.bookserver.chat.utils;

import com.alibaba.fastjson.JSON;
import com.ycb.bookserver.chat.utils.pojo.ResultMessage;

public class MessageUtils {
    public static String getMessage(boolean isSystemMessage, Long fromId,Long toId, String message) {
        ResultMessage resultMessage = new ResultMessage();
        resultMessage.setSystemMessage(isSystemMessage);
        resultMessage.setMessage(message);
        if(fromId != null) {
            resultMessage.setFromId(fromId);
        }
        resultMessage.setToId(toId);
        return JSON.toJSONString(resultMessage);
    }
}
